package com.ruoyi.exam.service.impl;

import java.util.List;
import java.util.UUID;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.exam.mapper.QuestionsTypeMapper;
import com.ruoyi.exam.domain.QuestionsType;
import com.ruoyi.exam.service.IQuestionsTypeService;

/**
 * 试题类型Service业务层处理
 *
 * @author 王室
 * @date 2021-10-12
 */
@Service
public class QuestionsTypeServiceImpl implements IQuestionsTypeService
{
    @Autowired
    private QuestionsTypeMapper questionsTypeMapper;

    /**
     * 查询试题类型
     *
     * @param id 试题类型主键
     * @return 试题类型
     */
    @Override
    public QuestionsType selectQuestionsTypeById(String id)
    {
        return questionsTypeMapper.selectQuestionsTypeById(id);
    }

    /**
     * 查询试题类型列表
     *
     * @param questionsType 试题类型
     * @return 试题类型
     */
    @Override
    public List<QuestionsType> selectQuestionsTypeList(QuestionsType questionsType)
    {
        return questionsTypeMapper.selectQuestionsTypeList(questionsType);
    }

    /**
     * 新增试题类型
     *
     * @param questionsType 试题类型
     * @return 结果
     */
    @Override
    public int insertQuestionsType(QuestionsType questionsType)
    {
        questionsType.setId(UUID.randomUUID().toString().replaceAll("-",""));
        questionsType.setCreateTime(DateUtils.getNowDate());
        return questionsTypeMapper.insertQuestionsType(questionsType);
    }

    /**
     * 修改试题类型
     *
     * @param questionsType 试题类型
     * @return 结果
     */
    @Override
    public int updateQuestionsType(QuestionsType questionsType)
    {
        questionsType.setUpdateTime(DateUtils.getNowDate());
        return questionsTypeMapper.updateQuestionsType(questionsType);
    }

    /**
     * 批量删除试题类型
     *
     * @param ids 需要删除的试题类型主键
     * @return 结果
     */
    @Override
    public int deleteQuestionsTypeByIds(String[] ids)
    {
        return questionsTypeMapper.deleteQuestionsTypeByIds(ids);
    }

    /**
     * 删除试题类型信息
     *
     * @param id 试题类型主键
     * @return 结果
     */
    @Override
    public int deleteQuestionsTypeById(String id)
    {
        return questionsTypeMapper.deleteQuestionsTypeById(id);
    }
}
